{% import 'Import/app_import.html.twig' as appImport %}
<ul class="nav nav-tabs mb-4">
    <li class="nav-item">
        <a class="nav-link {% if 'summary' == active %}active {{ theme_tab_active }}{% else %}{{ theme_tab }}{% endif %}" href="{{ path('indices_read', {'index': index.name}) }}">{{ 'summary'|trans }}</a>
    </li>

    {% if is_granted('INDEX_UPDATE', index) %}
        <li class="nav-item">
            <a class="nav-link {% if 'update' == active %}active {{ theme_tab_active }}{% else %}{{ theme_tab }}{% endif %}" href="{{ path('indices_update', {'index': index.name}) }}">{{ 'update'|trans }}</a>
        </li>
    {% endif %}

    <li class="nav-item">
        <a class="nav-link {% if 'settings' == active %}active {{ theme_tab_active }}{% else %}{{ theme_tab }}{% endif %}" href="{{ path('indices_read_settings', {'index': index.name}) }}">{{ 'settings'|trans }}</a>
    </li>

    <li class="nav-item">
        <a class="nav-link {% if 'mappings' == active %}active {{ theme_tab_active }}{% else %}{{ theme_tab }}{% endif %}" href="{{ path('indices_read_mappings', {'index': index.name}) }}">{{ 'mappings'|trans }}</a>
    </li>

    {% if is_granted('INDEX_LIFECYCLE', index) %}
        <li class="nav-item">
            <a class="nav-link {% if 'lifecycle' == active %}active {{ theme_tab_active }}{% else %}{{ theme_tab }}{% endif %}" href="{{ path('indices_read_lifecycle', {'index': index.name}) }}">{{ 'lifecycle'|trans }}{% if index.setting('index.lifecycle.name') %}{{ appImport.badge({'title': 'managed'|trans, 'context': 'true'}) }}{% endif %}</a>
        </li>
    {% endif %}

    {% if is_granted('INDEX_SEARCH', index) %}
        <li class="nav-item">
            <a class="nav-link {% if 'search' == active %}active {{ theme_tab_active }}{% else %}{{ theme_tab }}{% endif %}" href="{{ path('indices_read_search', {'index': index.name}) }}">{{ 'search'|trans }}</a>
        </li>
    {% endif %}

    {% if is_granted('INDEX_IMPORT', index) %}
        <li class="nav-item dropdown">
            <a class="nav-link dropdown-toggle {% if 'import_from_' in active %}active {{ theme_tab_active }}{% else %}{{ theme_tab }}{% endif %}" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">{{ 'import'|trans }}</a>
            <div class="dropdown-menu {{ theme_dropdown_menu }}">
                <a class="dropdown-item{% if 'import_from_file' == active %} active bg-{{ theme_color_1 }}{% endif %}" href="{{ path('indices_read_import', {'index': index.name}) }}">{{ 'import_from_file'|trans }}</a>
                <a class="dropdown-item{% if 'import_from_database' == active %} active bg-{{ theme_color_1 }}{% endif %}" href="{{ path('index_database_import', {'index': index.name}) }}">{{ 'import_from_database'|trans }}</a>
            </div>
        </li>

        <li class="nav-item">
        </li>

        <li class="nav-item">
        </li>
    {% endif %}

    {% if is_granted('INDEX_ALIASES', index) %}
        <li class="nav-item">
            <a class="nav-link {% if 'aliases' == active %}active {{ theme_tab_active }}{% else %}{{ theme_tab }}{% endif %}" href="{{ path('indices_read_aliases', {'index': index.name}) }}">{{ 'aliases'|trans }}</a>
        </li>
    {% endif %}

    {% if is_granted('SHARDS', 'global') %}
        <li class="nav-item">
            <a class="nav-link {{ theme_tab }}" href="{{ path('shards', {'index': index.name}) }}">{{ 'shards'|trans }}</a>
        </li>
    {% endif %}

    {% if is_granted('INDICES_REINDEX', 'index') and false == index.isSystem %}
        <li class="nav-item">
            <a class="nav-link {{ theme_tab }}" href="{{ path('indices_reindex', {'index': index.name}) }}">{{ 'reindex'|trans }}</a>
        </li>
    {% endif %}
</ul>
